USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_update]    Script Date: 11/19/2014 08:06:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_update]
@magv nchar(50),
@makhoa nvarchar(50),
@maphong nvarchar(50),
@maca nvarchar(50),
@malop nchar(10)
as
	Update PhanCong 
	Set MaGiaoVien=@magv, 
	MaKhoa = @makhoa , 
	MaLop = @malop,
	MaCa = @maca,
	MaPhong = @maphong

	Where MaGiaoVien=@magv and
		MaKhoa = @makhoa and 
	MaLop = @malop and
	MaCa = @maca and
	MaPhong = @maphong


-----------------------------------------------------------------------------

USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loaddgvphancong]    Script Date: 11/19/2014 08:06:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loaddgvphancong]
as
select * from PhanCong 
inner join GiaoVien on PhanCong.MaGiaoVien = GiaoVien.MaGiaoVien
inner join PhongHoc on PhongHoc.MaPhong=PhanCong.MaPhong 
inner join Lop on PhanCong.MaLop = Lop.MaLop
inner join KhoaHoc on PhanCong.MaKhoa = KhoaHoc.MaKhoa
inner join CaHoc on PhanCong.MaCa = CaHoc.MaCa

---------------------------------------------------------------------------------------


USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loadcbophong]    Script Date: 11/19/2014 08:06:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loadcbophong]
as 
select * from PhongHoc


---------------------------------------------------------------------------------------------------



USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loadcbolop]    Script Date: 11/19/2014 08:06:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loadcbolop]
as
select * from Lop

-----------------------------------------------------------------------------------------------------------------



USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loadcbokhoa]    Script Date: 11/19/2014 08:06:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loadcbokhoa]
as
select * from KhoaHoc


--------------------------------------------------------------------------------------------------------------------------------



USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loadcbogv]    Script Date: 11/19/2014 08:06:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loadcbogv]
as
select * from GiaoVien



--------------------------------------------------------------------------------------------------------------------------------



USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_loadcboca]    Script Date: 11/19/2014 08:05:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_loadcboca]
as
select * from CaHoc





--------------------------------------------------------------------------------------------------------------------------------


USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_insert]    Script Date: 11/19/2014 08:04:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_insert]
@magv nchar(50),
@makhoa nvarchar(50),
@maphong nvarchar(50),
@maca nvarchar(50),
@malop nchar(10)
as
insert into PhanCong(MaGiaoVien,MaKhoa,MaLop,MaPhong,MaCa)
values (@magv,@makhoa,@malop,@maphong,@maca)







--------------------------------------------------------------------------------------------------------------------------------




USE [DBQuanLyTrungTamTinHoc]
GO
/****** Object:  StoredProcedure [dbo].[sp_phancong_Delete]    Script Date: 11/19/2014 08:03:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[sp_phancong_Delete]
@maca nchar(10),
@magv nchar(10),
@maphong nchar(10),
@malop nchar(10),
@makhoa nchar(10)
as
delete phancong
where @maca=MaCa and 
@magv = MaGiaoVien and 
@makhoa = MaKhoa and 
@malop = MaLop and 
@maphong = MaPhong





--------------------------------------------------------------------------------------------------------------------------------
